package tengxun;

import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.Comparator;

public class Main2 {

    public static void main(String[] args) throws Exception{
        BufferedReader buf = new BufferedReader(new InputStreamReader(System.in));
        int T = Integer.parseInt(buf.readLine());
        StringBuilder sb = new StringBuilder();
        for (int t = 0; t < T; t++){
            int n = Integer.parseInt(buf.readLine());
            String s = buf.readLine();
            String[] ss = s.split(" ");
            Integer[] arr = new Integer[n];
            for (int i = 0; i < n; i++){
                arr[i] = Integer.parseInt(ss[i]);
            }
            int res = 0;
            Comparator<Integer> cmp = new Comparator<Integer>() {
                public int compare(Integer i1, Integer i2) {
                    return i2-i1;
                }
            };
            Arrays.sort(arr, cmp);
            for (int i = 0; i < n; i++){
                int sum = (res + arr[i]%1000000007);
                res = (res+sum)%1000000007;
            }
            sb.append(res).append("\n");


        }
        System.out.println(sb.toString());
        ReflactionHelper reflactionHelper = new ReflactionHelper();
        reflactionHelper.fun();
    }
    static class ReflactionHelper{

        public static void fun(){
            System.out.println("aaaa");
        }
    }

}



